#include "GUIRenderQueue.h"
#include <algorithm>

namespace YGUI
{
    void RenderQueue::draw(void) const
    {
        for(BufferList::const_iterator it = m_geoBuf.begin(); it != m_geoBuf.end(); ++it)
            (*it)->draw();
    }

    void RenderQueue::reset(void)
    {
        m_geoBuf.clear();
    }

    void RenderQueue::addGeometryBuffer(const GeometryBuffer& buf)
    {
        m_geoBuf.push_back(&buf);
    }

    void RenderQueue::removeGeometryBuffer(const GeometryBuffer& buf)
    {
        BufferList::iterator it = std::find(m_geoBuf.begin(), m_geoBuf.end(), &buf);
        if(it != m_geoBuf.end())
            m_geoBuf.erase(it);
    }
};